#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 日志的级别：debug < info < warning < error < critical
import logging

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
                    datefmt='%y-%m-%d %H:%M:%S',
                    filename='myapp.log',
                    filemode='w')

logging.debug('This is a debug message')
logging.info('This is an info message')
logging.warning('This is a warning message')
logging.error('This is an error message')
logging.critical('This is a critical message')

